<!-- 老师申请及信息表表单弹窗 -->
<form id="teacher-form" lay-filter="teacher-form" class="layui-form model-form" style="overflow:auto; height:500px;width:90%;">
    <input name="id" type="hidden"/>
    				    <div class="layui-form-item">
        <label class="layui-form-label">商家</label>
        <div class="layui-input-block">
            <input name="businessId" placeholder="请输入商家" type="hidden" class="layui-input" maxlength="20"  id="businessId"
                   lay-verify="required" required/>
            <input name="businessName" placeholder="请输入商家" type="text" class="layui-input" maxlength="20"  id="businessName"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">审核人</label>
        <div class="layui-input-block">
            <input name="memberId" placeholder="请输入审核人" type="hidden" class="layui-input" maxlength="20"  id="memberId"
                   lay-verify="required" required/>
            <input name="checkName"  type="text" class="layui-input" maxlength="20"  id="checkName"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">真实姓名</label>
        <div class="layui-input-block">
            <input name="name" placeholder="请输入真实姓名" type="text" class="layui-input" maxlength="20"  id="name"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">艺名</label>
        <div class="layui-input-block">
            <input name="nickname" placeholder="请输入艺名" type="text" class="layui-input" maxlength="20"  id="nickname"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">技能选项</label>
        <div class="layui-input-block">
            <input name="skills" placeholder="请输入技能选项" type="text" class="layui-input" maxlength="20"  id="skills"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input name="status" placeholder="请输入状态，1-待审核，2-已审核， -1-驳回" type="hidden" class="layui-input" maxlength="20"  id="status"
                   lay-verify="required"  required/>
            <input name="strStatus"  type="text" class="layui-input"   readonly  />
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">特长描述</label>
        <div class="layui-input-block">
            <input name="specialty" placeholder="请输入特长描述" type="text" class="layui-input" maxlength="20"  id="specialty"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">详细介绍自己</label>
        <div class="layui-input-block">
            <input name="description" placeholder="请输入详细介绍自己" type="text" class="layui-input" maxlength="20"  id="description"
                   lay-verify="required" readonly required/>
        </div>
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">身份证正面</label>
        <!--<div class="layui-input-block">-->
            <!--<input name="idcardPositive" placeholder="请输入身份证正面" type="text" class="layui-input" maxlength="20"  id="idcardPositive"-->
                   <!--lay-verify="required" required/>-->
        <!--</div>-->
                <img id="idcard1image" src="" width="50" />
    </div>
 		    <div class="layui-form-item">
        <label class="layui-form-label">身份证反面</label>
        <!--<div class="layui-input-block">-->
            <!--<input name="idcardOtherside" placeholder="请输入身份证反面" type="text" class="layui-input" maxlength="20"  id="idcardOtherside"-->
                   <!--lay-verify="required" required/>-->
        <!--</div>-->
                <img id="idcard2image" src="" width="50" />
    </div>


     <div class="layui-form-item model-form-footer">
        <button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
        <!--<button class="layui-btn" lay-filter="user-form-submit" lay-submit>保存</button>-->
    </div>
</form>

<script>
    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
        var layer = layui.layer;
        var admin = layui.admin;
        var form = layui.form;
        var formSelects = layui.formSelects;
 
        var teacher = admin.getTempData('t_teacher');
           if (teacher.method=="update"){

        	if(teacher.idcardPositive)
        	$("#idcard1image").attr("src",teacher.idcardPositive);
        	else
                $("#idcard1image").attr("src",'assets/images/default.png');
        	if(teacher.idcardOtherside)
        	    $("#idcard2image").attr("src",teacher.idcardOtherside);
            else
                $("#idcard2image").attr("src",'assets/images/default.png');

            if(teacher.status==1){
                teacher.strStatus="待审核";
            }else if(teacher.status==2){
                teacher.strStatus="已审核";
            }else if(teacher.status==-1){
                teacher.strStatus="驳回";
            }
               form.val('teacher-form', teacher);
            form.render();
        }
        // 表单提交事件
        form.on('submit(user-form-submit)', function (data) {
             layer.load(2);
            
            admin.req('teacher/teacher/'+teacher.method, JSON.stringify(data.field), function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg, {icon: 1, time: 500});
                    admin.finishPopupCenter();
                } else {
                    layer.msg(data.msg, {icon: 2, time: 500});
                }
            }, "post");  
            return false;
        });
    });
</script>
